package main

import "fmt"

//full var (type can be omitted)
var a int = 7
var b int = 8
func main() {
	//party var
	a,b,c:= 10,20,0
	fmt.Printf("main函数中a=%d\n",a)
	fmt.Printf("main函数中b=%d\n",b)
	fmt.Printf("main函数中c=%d\n",c)

	c = sum(a,b)
	fmt.Printf("main函数中ab相加后的c=%d\n",c)

	c,_= sum3(a,b)
}
//count sum
func  sum(a,b int) int {
	a++
	b+=2
	c:=a+b
	fmt.Printf("sum()函数中a=%d\n",a)
	fmt.Printf("sum()函数中b=%d\n",b)
	fmt.Printf("sum()函数中c=%d\n",c)
	return c
}

func  sum2(a,b int) (c int) {
	a++
	b+=2
	c=a+b
	fmt.Printf("sum()函数中a=%d\n",a)
	fmt.Printf("sum()函数中b=%d\n",b)
	fmt.Printf("sum()函数中c=%d\n",c)
	return
}

func  sum3(a,b int) (c,d int) {
	a++
	b+=2
	c=a+b
	d=a*b
	fmt.Printf("sum()函数中a=%d\n",a)
	fmt.Printf("sum()函数中b=%d\n",b)
	fmt.Printf("sum()函数中c=%d\n",c)
	return
}
